package com.platform.controller.backend;

import com.github.pagehelper.PageInfo;
import com.platform.common.ServerResponse;
import com.platform.pojo.Role;
import com.platform.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * 角色控制层
 */
@Controller
@RequestMapping("/roleController/")
public class RoleController {
    @Autowired
    private IRoleService iRoleService;

    @RequestMapping(value = "add.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<String> addRole(@RequestParam Map paramMap){
        return iRoleService.insert(paramMap);
    }

    @RequestMapping(value = "del.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<String> delRole(Integer id){
        return iRoleService.del(id);
    }

    @RequestMapping(value = "selectByParam.do",method = RequestMethod.GET)
    @ResponseBody
    public ServerResponse<PageInfo> selectByParam(@RequestParam Map param){
        return iRoleService.selectByParam(param);
    }

    @RequestMapping(value = "update.do",method = RequestMethod.POST)
    @ResponseBody
    public ServerResponse<String> update(@RequestParam Map paramMap){
        return iRoleService.update(paramMap);
    }
}
